package com.holly.unit.bpmn.designer.enums;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * 类描述: 审批人为空时如何操作枚举类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/5/7 9:57
 */
public enum UserEmptyOperatorEnum {

    // 自动通过
    TO_PASS("TO_PASS"),
    // 自动转交给管理员
    TO_ADMIN("TO_ADMIN"),
    // 转交到指定人员
    TO_USER("TO_USER");

    String fieldName;

    UserEmptyOperatorEnum(String fieldName) {
        this.fieldName = fieldName;
    }

    public String fieldName() {
        return this.fieldName;
    }

    public static UserEmptyOperatorEnum of(String fieldName) {
        return Stream.of(UserEmptyOperatorEnum.values())
                .filter(clazz -> Objects.equals(clazz.fieldName(), fieldName))
                .findFirst()
                .orElse(TO_PASS);
    }


}
